<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Instance.Class</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-6"></span><span>     </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchGlobalInst"><span class="hs-identifier">matchGlobalInst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-7"></span><span>     </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier">ClsInstResult</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-8"></span><span>     </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier">InstanceWhat</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#safeOverlap"><span class="hs-identifier">safeOverlap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier">instanceReturnsDictCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>     </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#AssocInstInfo"><span class="hs-identifier">AssocInstInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#isNotAssociated"><span class="hs-identifier">isNotAssociated</span></a></span><span>
</span><span id="line-10"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html"><span class="hs-identifier">GHC.Tc.Utils.Instantiate</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html#tcInstType"><span class="hs-identifier">tcInstType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html"><span class="hs-identifier">GHC.Tc.Instance.Typeable</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html"><span class="hs-identifier">GHC.Tc.Utils.TcMType</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html"><span class="hs-identifier">GHC.Core.Predicate</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Env.html"><span class="hs-identifier">GHC.Rename.Env</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Rename.Env.html#addUsedGRE"><span class="hs-identifier">addUsedGRE</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#lookupGRE_FieldLabel"><span class="hs-identifier">lookupGRE_FieldLabel</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.InstEnv.html"><span class="hs-identifier">GHC.Core.InstEnv</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html"><span class="hs-identifier">GHC.Tc.Utils.Instantiate</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html#instDFunType"><span class="hs-identifier">instDFunType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html"><span class="hs-identifier">GHC.Tc.Instance.Family</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html#tcGetFamInstEnvs"><span class="hs-identifier">tcGetFamInstEnvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html#tcInstNewTyCon_maybe"><span class="hs-identifier">tcInstNewTyCon_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html#tcLookupDataFamInst"><span class="hs-identifier">tcLookupDataFamInst</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html#eqPrimTyCon"><span class="hs-identifier">eqPrimTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html#eqReprPrimTyCon"><span class="hs-identifier">eqReprPrimTyCon</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Make.html"><span class="hs-identifier">GHC.Core.Make</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Make.html#mkStringExprFS"><span class="hs-identifier">mkStringExprFS</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Make.html#mkNaturalExpr"><span class="hs-identifier">mkNaturalExpr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#pprDefinedAt"><span class="hs-identifier">pprDefinedAt</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#VarEnv"><span class="hs-identifier">VarEnv</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Class.html"><span class="hs-identifier">GHC.Core.Class</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier">splitAtList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier">fstOf3</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-comment">{- *******************************************************************
*                                                                    *
              A helper for associated types within
              class instance declarations
*                                                                    *
**********************************************************************-}</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">-- | Extra information about the parent instance declaration, needed</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- when type-checking associated types. The 'Class' is the enclosing</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- class, the [TyVar] are the /scoped/ type variable of the instance decl.</span><span>
</span><span id="line-58"></span><span class="hs-comment">-- The @VarEnv Type@ maps class variables to their instance types.</span><span>
</span><span id="line-59"></span><span class="hs-keyword">data</span><span> </span><span id="AssocInstInfo"><span class="annot"><a href="GHC.Tc.Instance.Class.html#AssocInstInfo"><span class="hs-identifier hs-var">AssocInstInfo</span></a></span></span><span>
</span><span id="line-60"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NotAssociated"><span class="annot"><a href="GHC.Tc.Instance.Class.html#NotAssociated"><span class="hs-identifier hs-var">NotAssociated</span></a></span></span><span>
</span><span id="line-61"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="InClsInst"><span class="annot"><a href="GHC.Tc.Instance.Class.html#InClsInst"><span class="hs-identifier hs-var">InClsInst</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="ai_class"><span class="annot"><span class="annottext">AssocInstInfo -&gt; Class
</span><a href="GHC.Tc.Instance.Class.html#ai_class"><span class="hs-identifier hs-var hs-var">ai_class</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span>
</span><span id="line-62"></span><span>              </span><span class="hs-special">,</span><span> </span><span id="ai_tyvars"><span class="annot"><span class="annottext">AssocInstInfo -&gt; [DFunId]
</span><a href="GHC.Tc.Instance.Class.html#ai_tyvars"><span class="hs-identifier hs-var hs-var">ai_tyvars</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- ^ The /scoped/ tyvars of the instance</span><span>
</span><span id="line-63"></span><span>                                            </span><span class="hs-comment">-- Why scoped?  See bind_me in</span><span>
</span><span id="line-64"></span><span>                                            </span><span class="hs-comment">-- 'GHC.Tc.Validity.checkConsistentFamInst'</span><span>
</span><span id="line-65"></span><span>              </span><span class="hs-special">,</span><span> </span><span id="ai_inst_env"><span class="annot"><span class="annottext">AssocInstInfo -&gt; VarEnv Type
</span><a href="GHC.Tc.Instance.Class.html#ai_inst_env"><span class="hs-identifier hs-var hs-var">ai_inst_env</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#VarEnv"><span class="hs-identifier hs-type">VarEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>  </span><span class="hs-comment">-- ^ Maps /class/ tyvars to their instance types</span><span>
</span><span id="line-66"></span><span>                </span><span class="hs-comment">-- See Note [Matching in the consistent-instantiation check]</span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#isNotAssociated"><span class="hs-identifier hs-type">isNotAssociated</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#AssocInstInfo"><span class="hs-identifier hs-type">AssocInstInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-70"></span><span id="isNotAssociated"><span class="annot"><span class="annottext">isNotAssociated :: AssocInstInfo -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#isNotAssociated"><span class="hs-identifier hs-var hs-var">isNotAssociated</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#NotAssociated"><span class="hs-identifier hs-type">NotAssociated</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-71"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#isNotAssociated"><span class="hs-identifier hs-var">isNotAssociated</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InClsInst"><span class="hs-identifier hs-type">InClsInst</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span class="hs-comment">{- *******************************************************************
*                                                                    *
                       Class lookup
*                                                                    *
**********************************************************************-}</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-comment">-- | Indicates if Instance met the Safe Haskell overlapping instances safety</span><span>
</span><span id="line-81"></span><span class="hs-comment">-- check.</span><span>
</span><span id="line-82"></span><span class="hs-comment">--</span><span>
</span><span id="line-83"></span><span class="hs-comment">-- See Note [Safe Haskell Overlapping Instances] in GHC.Tc.Solver</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver</span><span>
</span><span id="line-85"></span><span class="hs-keyword">type</span><span> </span><span id="SafeOverlapping"><span class="annot"><a href="GHC.Tc.Instance.Class.html#SafeOverlapping"><span class="hs-identifier hs-var">SafeOverlapping</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-keyword">data</span><span> </span><span id="ClsInstResult"><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-var">ClsInstResult</span></a></span></span><span>
</span><span id="line-88"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NoInstance"><span class="annot"><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span></span><span>   </span><span class="hs-comment">-- Definitely no instance</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="OneInst"><span class="annot"><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-var">OneInst</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="cir_new_theta"><span class="annot"><span class="annottext">ClsInstResult -&gt; [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var hs-var">cir_new_theta</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-91"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="cir_mk_ev"><span class="annot"><span class="annottext">ClsInstResult -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var hs-var">cir_mk_ev</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-type">EvExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvTerm"><span class="hs-identifier hs-type">EvTerm</span></a></span><span>
</span><span id="line-92"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="cir_what"><span class="annot"><span class="annottext">ClsInstResult -&gt; InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var hs-var">cir_what</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier hs-type">InstanceWhat</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="NotSure"><span class="annot"><a href="GHC.Tc.Instance.Class.html#NotSure"><span class="hs-identifier hs-var">NotSure</span></a></span></span><span>      </span><span class="hs-comment">-- Multiple matches and/or one or more unifiers</span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span class="hs-keyword">data</span><span> </span><span id="InstanceWhat"><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier hs-var">InstanceWhat</span></a></span></span><span>
</span><span id="line-97"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="BuiltinInstance"><span class="annot"><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span></span><span>
</span><span id="line-98"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BuiltinEqInstance"><span class="annot"><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span></span><span>   </span><span class="hs-comment">-- A built-in &quot;equality instance&quot;; see the</span><span>
</span><span id="line-99"></span><span>                        </span><span class="hs-comment">-- GHC.Tc.Solver.Monad Note [Solved dictionaries]</span><span>
</span><span id="line-100"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LocalInstance"><span class="annot"><a href="GHC.Tc.Instance.Class.html#LocalInstance"><span class="hs-identifier hs-var">LocalInstance</span></a></span></span><span>
</span><span id="line-101"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TopLevInstance"><span class="annot"><a href="GHC.Tc.Instance.Class.html#TopLevInstance"><span class="hs-identifier hs-var">TopLevInstance</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="iw_dfun_id"><span class="annot"><span class="annottext">InstanceWhat -&gt; DFunId
</span><a href="GHC.Tc.Instance.Class.html#iw_dfun_id"><span class="hs-identifier hs-var hs-var">iw_dfun_id</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#DFunId"><span class="hs-identifier hs-type">DFunId</span></a></span><span>
</span><span id="line-102"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="iw_safe_over"><span class="annot"><span class="annottext">InstanceWhat -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#iw_safe_over"><span class="hs-identifier hs-var hs-var">iw_safe_over</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#SafeOverlapping"><span class="hs-identifier hs-type">SafeOverlapping</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681105990"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-105"></span><span>  </span><span id="local-6989586621681105986"><span class="annot"><span class="annottext">ppr :: ClsInstResult -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;NoInstance&quot;</span></span><span>
</span><span id="line-106"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NotSure"><span class="hs-identifier hs-var">NotSure</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;NotSure&quot;</span></span><span>
</span><span id="line-107"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: ClsInstResult -&gt; [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681105983"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105983"><span class="hs-identifier hs-var">ev</span></a></span></span><span>
</span><span id="line-108"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: ClsInstResult -&gt; InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681105982"><span class="annot"><span class="annottext">InstanceWhat
</span><a href="#local-6989586621681105982"><span class="hs-identifier hs-var">what</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;OneInst&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105983"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">InstanceWhat -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="#local-6989586621681105982"><span class="hs-identifier hs-var">what</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681105977"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier hs-type">InstanceWhat</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-112"></span><span>  </span><span id="local-6989586621681105976"><span class="annot"><span class="annottext">ppr :: InstanceWhat -&gt; SDoc
</span><a href="#local-6989586621681105976"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a built-in instance&quot;</span></span><span>
</span><span id="line-113"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a built-in equality instance&quot;</span></span><span>
</span><span id="line-114"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#LocalInstance"><span class="hs-identifier hs-var">LocalInstance</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;a locally-quantified instance&quot;</span></span><span>
</span><span id="line-115"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#TopLevInstance"><span class="hs-identifier hs-type">TopLevInstance</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">iw_dfun_id :: InstanceWhat -&gt; DFunId
</span><a href="GHC.Tc.Instance.Class.html#iw_dfun_id"><span class="hs-identifier hs-var">iw_dfun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681105975"><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105975"><span class="hs-identifier hs-var">dfun</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;instance&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprSigmaType"><span class="hs-identifier hs-var">pprSigmaType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105975"><span class="hs-identifier hs-var">dfun</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-117"></span><span>           </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprDefinedAt"><span class="hs-identifier hs-var">pprDefinedAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105975"><span class="hs-identifier hs-var">dfun</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#safeOverlap"><span class="hs-identifier hs-type">safeOverlap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier hs-type">InstanceWhat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-120"></span><span id="safeOverlap"><span class="annot"><span class="annottext">safeOverlap :: InstanceWhat -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#safeOverlap"><span class="hs-identifier hs-var hs-var">safeOverlap</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#TopLevInstance"><span class="hs-identifier hs-type">TopLevInstance</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">iw_safe_over :: InstanceWhat -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#iw_safe_over"><span class="hs-identifier hs-var">iw_safe_over</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681105970"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105970"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105970"><span class="hs-identifier hs-var">so</span></a></span><span>
</span><span id="line-121"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#safeOverlap"><span class="hs-identifier hs-var">safeOverlap</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><span class="hs-identifier">_</span></span><span>                                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier hs-type">instanceReturnsDictCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#InstanceWhat"><span class="hs-identifier hs-type">InstanceWhat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-124"></span><span class="hs-comment">-- See Note [Solved dictionaries] in GHC.Tc.Solver.Monad</span><span>
</span><span id="line-125"></span><span id="instanceReturnsDictCon"><span class="annot"><span class="annottext">instanceReturnsDictCon :: InstanceWhat -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier hs-var hs-var">instanceReturnsDictCon</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Class.html#TopLevInstance"><span class="hs-identifier hs-type">TopLevInstance</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-126"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier hs-var">instanceReturnsDictCon</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-127"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier hs-var">instanceReturnsDictCon</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-128"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#instanceReturnsDictCon"><span class="hs-identifier hs-var">instanceReturnsDictCon</span></a></span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#LocalInstance"><span class="hs-identifier hs-var">LocalInstance</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchGlobalInst"><span class="hs-identifier hs-type">matchGlobalInst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-131"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>      </span><span class="hs-comment">-- True &lt;=&gt; caller is the short-cut solver</span><span>
</span><span id="line-132"></span><span>                             </span><span class="hs-comment">-- See Note [Shortcut solving: overlap]</span><span>
</span><span id="line-133"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-134"></span><span id="matchGlobalInst"><span class="annot"><span class="annottext">matchGlobalInst :: DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchGlobalInst"><span class="hs-identifier hs-var hs-var">matchGlobalInst</span></a></span></span><span> </span><span id="local-6989586621681105969"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105969"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681105968"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105968"><span class="hs-identifier hs-var">short_cut</span></a></span></span><span> </span><span id="local-6989586621681105967"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105966"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-135"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105965"><span class="hs-identifier hs-var">cls_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#knownNatClassName"><span class="hs-identifier hs-var">knownNatClassName</span></a></span><span>
</span><span id="line-136"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchKnownNat"><span class="hs-identifier hs-var">matchKnownNat</span></a></span><span>    </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105969"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105968"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-137"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105965"><span class="hs-identifier hs-var">cls_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#knownSymbolClassName"><span class="hs-identifier hs-var">knownSymbolClassName</span></a></span><span>
</span><span id="line-138"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchKnownSymbol"><span class="hs-identifier hs-var">matchKnownSymbol</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105969"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105968"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-139"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isCTupleClass"><span class="hs-identifier hs-var">isCTupleClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchCTuple"><span class="hs-identifier hs-var">matchCTuple</span></a></span><span>          </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-140"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105965"><span class="hs-identifier hs-var">cls_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#typeableClassName"><span class="hs-identifier hs-var">typeableClassName</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchTypeable"><span class="hs-identifier hs-var">matchTypeable</span></a></span><span>        </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#heqTyConKey"><span class="hs-identifier hs-var">heqTyConKey</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHeteroEquality"><span class="hs-identifier hs-var">matchHeteroEquality</span></a></span><span>       </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-142"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#eqTyConKey"><span class="hs-identifier hs-var">eqTyConKey</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHomoEquality"><span class="hs-identifier hs-var">matchHomoEquality</span></a></span><span>         </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#coercibleTyConKey"><span class="hs-identifier hs-var">coercibleTyConKey</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchCoercible"><span class="hs-identifier hs-var">matchCoercible</span></a></span><span>            </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-144"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105965"><span class="hs-identifier hs-var">cls_name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#hasFieldClassName"><span class="hs-identifier hs-var">hasFieldClassName</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHasField"><span class="hs-identifier hs-var">matchHasField</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105969"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105968"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-145"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var">matchInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105969"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105968"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105966"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-146"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-147"></span><span>    </span><span id="local-6989586621681105965"><span class="annot"><span class="annottext">cls_name :: Name
</span><a href="#local-6989586621681105965"><span class="hs-identifier hs-var hs-var">cls_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Name
</span><a href="GHC.Core.Class.html#className"><span class="hs-identifier hs-var hs-var">className</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105967"><span class="hs-identifier hs-var">clas</span></a></span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
                   Looking in the instance environment
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-type">matchInstEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-158"></span><span id="matchInstEnv"><span class="annot"><span class="annottext">matchInstEnv :: DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var hs-var">matchInstEnv</span></a></span></span><span> </span><span id="local-6989586621681105945"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105945"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681105944"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105944"><span class="hs-identifier hs-var">short_cut_solver</span></a></span></span><span> </span><span id="local-6989586621681105943"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105943"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105942"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105942"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-159"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681105941"><span class="annot"><span class="annottext">InstEnvs
</span><a href="#local-6989586621681105941"><span class="hs-identifier hs-var">instEnvs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM InstEnvs
</span><a href="GHC.Tc.Utils.Env.html#tcGetInstEnvs"><span class="hs-identifier hs-var">tcGetInstEnvs</span></a></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105936"><span class="annot"><span class="annottext">safeOverlapCheck :: Bool
</span><a href="#local-6989586621681105936"><span class="hs-identifier hs-var hs-var">safeOverlapCheck</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SafeHaskellMode
</span><a href="GHC.Driver.Session.html#safeHaskell"><span class="hs-identifier hs-var hs-var">safeHaskell</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105945"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SafeHaskellMode -&gt; [SafeHaskellMode] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">SafeHaskellMode
</span><a href="GHC.Driver.Session.html#Sf_Safe"><span class="hs-identifier hs-var">Sf_Safe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SafeHaskellMode
</span><a href="GHC.Driver.Session.html#Sf_Trustworthy"><span class="hs-identifier hs-var">Sf_Trustworthy</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-161"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621681105931"><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105931"><span class="hs-identifier hs-var">matches</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105930"><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681105930"><span class="hs-identifier hs-var">unify</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105929"><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105929"><span class="hs-identifier hs-var">unsafeOverlaps</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; InstEnvs
-&gt; Class
-&gt; [Type]
-&gt; ([InstMatch], [ClsInst], [InstMatch])
</span><a href="GHC.Core.InstEnv.html#lookupInstEnv"><span class="hs-identifier hs-var">lookupInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">InstEnvs
</span><a href="#local-6989586621681105941"><span class="hs-identifier hs-var">instEnvs</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105943"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105942"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-162"></span><span>              </span><span id="local-6989586621681105926"><span class="annot"><span class="annottext">safeHaskFail :: Bool
</span><a href="#local-6989586621681105926"><span class="hs-identifier hs-var hs-var">safeHaskFail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105936"><span class="hs-identifier hs-var">safeOverlapCheck</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InstMatch] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105929"><span class="hs-identifier hs-var">unsafeOverlaps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchInstEnv&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-164"></span><span>            </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;goal:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105943"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105942"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-165"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matches:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105931"><span class="hs-identifier hs-var">matches</span></a></span><span>
</span><span id="line-166"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unify:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[ClsInst] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681105930"><span class="hs-identifier hs-var">unify</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-167"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105931"><span class="hs-identifier hs-var">matches</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681105930"><span class="hs-identifier hs-var">unify</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105926"><span class="hs-identifier hs-var">safeHaskFail</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span>            </span><span class="hs-comment">-- Nothing matches</span><span>
</span><span id="line-170"></span><span>            </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchClass not matching&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105921"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span>            </span><span class="hs-comment">-- A single match (&amp; no safe haskell failure)</span><span>
</span><span id="line-175"></span><span>            </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621681105920"><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681105920"><span class="hs-identifier hs-var">ispec</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105919"><span class="annot"><span class="annottext">[DFunInstType]
</span><a href="#local-6989586621681105919"><span class="hs-identifier hs-var">inst_tys</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-176"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105944"><span class="hs-identifier hs-var">short_cut_solver</span></a></span><span>      </span><span class="hs-comment">-- Called from the short-cut solver</span><span>
</span><span id="line-177"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ClsInst -&gt; Bool
</span><a href="GHC.Core.InstEnv.html#isOverlappable"><span class="hs-identifier hs-var">isOverlappable</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681105920"><span class="hs-identifier hs-var">ispec</span></a></span><span>
</span><span id="line-178"></span><span>                </span><span class="hs-comment">-- If the instance has OVERLAPPABLE or OVERLAPS or INCOHERENT</span><span>
</span><span id="line-179"></span><span>                </span><span class="hs-comment">-- then don't let the short-cut solver choose it, because a</span><span>
</span><span id="line-180"></span><span>                </span><span class="hs-comment">-- later instance might overlap it.  #14434 is an example</span><span>
</span><span id="line-181"></span><span>                </span><span class="hs-comment">-- See Note [Shortcut solving: overlap]</span><span>
</span><span id="line-182"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchClass: ignoring overlappable&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105921"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NotSure"><span class="hs-identifier hs-var">NotSure</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-186"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105917"><span class="annot"><span class="annottext">dfun_id :: DFunId
</span><a href="#local-6989586621681105917"><span class="hs-identifier hs-var hs-var">dfun_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInst -&gt; DFunId
</span><a href="GHC.Core.InstEnv.html#instanceDFunId"><span class="hs-identifier hs-var">instanceDFunId</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681105920"><span class="hs-identifier hs-var">ispec</span></a></span><span>
</span><span id="line-187"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchClass success&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-188"></span><span>                        </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dict&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105921"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-189"></span><span>                              </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;witness&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105917"><span class="hs-identifier hs-var">dfun_id</span></a></span><span>
</span><span id="line-190"></span><span>                                             </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105917"><span class="hs-identifier hs-var">dfun_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-191"></span><span>                                </span><span class="hs-comment">-- Record that this dfun is needed</span><span>
</span><span id="line-192"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DFunId -&gt; [DFunInstType] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#match_one"><span class="hs-identifier hs-var">match_one</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InstMatch] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105929"><span class="hs-identifier hs-var">unsafeOverlaps</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105917"><span class="hs-identifier hs-var">dfun_id</span></a></span><span> </span><span class="annot"><span class="annottext">[DFunInstType]
</span><a href="#local-6989586621681105919"><span class="hs-identifier hs-var">inst_tys</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>            </span><span class="hs-comment">-- More than one matches (or Safe Haskell fail!). Defer any</span><span>
</span><span id="line-195"></span><span>            </span><span class="hs-comment">-- reactions of a multitude until we learn more about the reagent</span><span>
</span><span id="line-196"></span><span>            </span><span class="annot"><span class="annottext">([InstMatch], [ClsInst], Bool)
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchClass multiple matches, deferring choice&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-197"></span><span>                        </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dict&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105921"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-198"></span><span>                              </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matches&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[InstMatch]
</span><a href="#local-6989586621681105931"><span class="hs-identifier hs-var">matches</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-199"></span><span>                      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NotSure"><span class="hs-identifier hs-var">NotSure</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-200"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-201"></span><span>     </span><span id="local-6989586621681105921"><span class="annot"><span class="annottext">pred :: Type
</span><a href="#local-6989586621681105921"><span class="hs-identifier hs-var hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105943"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105942"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#match_one"><span class="hs-identifier hs-type">match_one</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#SafeOverlapping"><span class="hs-identifier hs-type">SafeOverlapping</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#DFunId"><span class="hs-identifier hs-type">DFunId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.InstEnv.html#DFunInstType"><span class="hs-identifier hs-type">DFunInstType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-204"></span><span>             </span><span class="hs-comment">-- See Note [DFunInstType: instantiating types] in GHC.Core.InstEnv</span><span>
</span><span id="line-205"></span><span id="match_one"><span class="annot"><span class="annottext">match_one :: Bool -&gt; DFunId -&gt; [DFunInstType] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#match_one"><span class="hs-identifier hs-var hs-var">match_one</span></a></span></span><span> </span><span id="local-6989586621681105913"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105913"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span id="local-6989586621681105912"><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span></span><span> </span><span id="local-6989586621681105911"><span class="annot"><span class="annottext">[DFunInstType]
</span><a href="#local-6989586621681105911"><span class="hs-identifier hs-var">mb_inst_tys</span></a></span></span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;match_one&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[DFunInstType] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[DFunInstType]
</span><a href="#local-6989586621681105911"><span class="hs-identifier hs-var">mb_inst_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105909"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105909"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105908"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105908"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; [DFunInstType] -&gt; TcM ([Type], [Type])
</span><a href="GHC.Tc.Utils.Instantiate.html#instDFunType"><span class="hs-identifier hs-var">instDFunType</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span><span> </span><span class="annot"><span class="annottext">[DFunInstType]
</span><a href="#local-6989586621681105911"><span class="hs-identifier hs-var">mb_inst_tys</span></a></span><span>
</span><span id="line-208"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;match_one 2&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105909"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105908"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-209"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ClsInstResult -&gt; TcM ClsInstResult)
-&gt; ClsInstResult -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105908"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-210"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; [Type] -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evDFunApp"><span class="hs-identifier hs-var">evDFunApp</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105909"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-211"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TopLevInstance :: DFunId -&gt; Bool -&gt; InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#TopLevInstance"><span class="hs-identifier hs-type">TopLevInstance</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">iw_dfun_id :: DFunId
</span><a href="GHC.Tc.Instance.Class.html#iw_dfun_id"><span class="hs-identifier hs-var">iw_dfun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105912"><span class="hs-identifier hs-var">dfun_id</span></a></span><span>
</span><span id="line-212"></span><span>                                                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">iw_safe_over :: Bool
</span><a href="GHC.Tc.Instance.Class.html#iw_safe_over"><span class="hs-identifier hs-var">iw_safe_over</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105913"><span class="hs-identifier hs-var">so</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="hs-comment">{- Note [Shortcut solving: overlap]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have
  instance {-# OVERLAPPABLE #-} C a where ...
and we are typechecking
  f :: C a =&gt; a -&gt; a
  f = e  -- Gives rise to [W] C a

We don't want to solve the wanted constraint with the overlappable
instance; rather we want to use the supplied (C a)! That was the whole
point of it being overlappable!  #14434 wwas an example.

Alas even if the instance has no overlap flag, thus
  instance C a where ...
there is nothing to stop it being overlapped. GHC provides no way to
declare an instance as &quot;final&quot; so it can't be overlapped.  But really
only final instances are OK for short-cut solving.  Sigh. #15135
was a puzzling example.
-}</span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
                   Class lookup for CTuples
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchCTuple"><span class="hs-identifier hs-type">matchCTuple</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-243"></span><span id="matchCTuple"><span class="annot"><span class="annottext">matchCTuple :: Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchCTuple"><span class="hs-identifier hs-var hs-var">matchCTuple</span></a></span></span><span> </span><span id="local-6989586621681105906"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105906"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105905"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105905"><span class="hs-identifier hs-var">tys</span></a></span></span><span>   </span><span class="hs-comment">-- (isCTupleClass clas) holds</span><span>
</span><span id="line-244"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105905"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-245"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105904"><span class="hs-identifier hs-var">tuple_ev</span></a></span><span>
</span><span id="line-246"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>            </span><span class="hs-comment">-- The dfun *is* the data constructor!</span><span>
</span><span id="line-248"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-249"></span><span>     </span><span id="local-6989586621681105903"><span class="annot"><span class="annottext">data_con :: DataCon
</span><a href="#local-6989586621681105903"><span class="hs-identifier hs-var hs-var">data_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; DataCon
</span><a href="GHC.Core.TyCon.html#tyConSingleDataCon"><span class="hs-identifier hs-var">tyConSingleDataCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105906"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span>     </span><span id="local-6989586621681105904"><span class="annot"><span class="annottext">tuple_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105904"><span class="hs-identifier hs-var hs-var">tuple_ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; [Type] -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evDFunApp"><span class="hs-identifier hs-var">evDFunApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; DFunId
</span><a href="GHC.Core.DataCon.html#dataConWrapId"><span class="hs-identifier hs-var">dataConWrapId</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681105903"><span class="hs-identifier hs-var">data_con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105905"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
                   Class lookup for Literals
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span class="hs-comment">{-
Note [KnownNat &amp; KnownSymbol and EvLit]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A part of the type-level literals implementation are the classes
&quot;KnownNat&quot; and &quot;KnownSymbol&quot;, which provide a &quot;smart&quot; constructor for
defining singleton values.  Here is the key stuff from GHC.TypeNats

  class KnownNat (n :: Nat) where
    natSing :: SNat n

  newtype SNat (n :: Nat) = SNat Natural

Conceptually, this class has infinitely many instances:

  instance KnownNat 0       where natSing = SNat 0
  instance KnownNat 1       where natSing = SNat 1
  instance KnownNat 2       where natSing = SNat 2
  ...

In practice, we solve `KnownNat` predicates in the type-checker
(see GHC.Tc.Solver.Interact) because we can't have infinitely many instances.
The evidence (aka &quot;dictionary&quot;) for `KnownNat` is of the form `EvLit (EvNum n)`.

We make the following assumptions about dictionaries in GHC:
  1. The &quot;dictionary&quot; for classes with a single method---like `KnownNat`---is
     a newtype for the type of the method, so using a evidence amounts
     to a coercion, and
  2. Newtypes use the same representation as their definition types.

So, the evidence for `KnownNat` is just a value of the representation type,
wrapped in two newtype constructors: one to make it into a `SNat` value,
and another to make it into a `KnownNat` dictionary.

Also note that `natSing` and `SNat` are never actually exposed from the
library---they are just an implementation detail.  Instead, users see
a more convenient function, defined in terms of `natSing`:

  natVal :: KnownNat n =&gt; proxy n -&gt; Natural

The reason we don't use this directly in the class is that it is simpler
and more efficient to pass around a Natural rather than an entire function,
especially when the `KnowNat` evidence is packaged up in an existential.

The story for kind `Symbol` is analogous:
  * class KnownSymbol
  * newtype SSymbol
  * Evidence: a Core literal (e.g. mkNaturalExpr)


Note [Fabricating Evidence for Literals in Backpack]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let `T` be a type of kind `Nat`. When solving for a purported instance
of `KnownNat T`, ghc tries to resolve the type `T` to an integer `n`,
in which case the evidence `EvLit (EvNum n)` is generated on the
fly. It might appear that this is sufficient as users cannot define
their own instances of `KnownNat`. However, for backpack module this
would not work (see issue #15379). Consider the signature `Abstract`

&gt; signature Abstract where
&gt;   data T :: Nat
&gt;   instance KnownNat T

and a module `Util` that depends on it:

&gt; module Util where
&gt;  import Abstract
&gt;  printT :: IO ()
&gt;  printT = do print $ natVal (Proxy :: Proxy T)

Clearly, we need to &quot;use&quot; the dictionary associated with `KnownNat T`
in the module `Util`, but it is too early for the compiler to produce
a real dictionary as we still have not fixed what `T` is. Only when we
mixin a concrete module

&gt; module Concrete where
&gt;   type T = 42

do we really get hold of the underlying integer. So the strategy that
we follow is the following

1. If T is indeed available as a type alias for an integer constant,
   generate the dictionary on the fly, failing which

2. Look up the type class environment for the evidence.

Finally actual code gets generate for Util only when a module like
Concrete gets &quot;mixed-in&quot; in place of the signature Abstract. As a
result all things, including the typeclass instances, in Concrete gets
reexported. So `KnownNat` gets resolved the normal way post-Backpack.

A similar generation works for `KnownSymbol` as well

-}</span><span>
</span><span id="line-352"></span><span>
</span><span id="line-353"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchKnownNat"><span class="hs-identifier hs-type">matchKnownNat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-354"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>      </span><span class="hs-comment">-- True &lt;=&gt; caller is the short-cut solver</span><span>
</span><span id="line-355"></span><span>                           </span><span class="hs-comment">-- See Note [Shortcut solving: overlap]</span><span>
</span><span id="line-356"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-357"></span><span id="matchKnownNat"><span class="annot"><span class="annottext">matchKnownNat :: DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchKnownNat"><span class="hs-identifier hs-var hs-var">matchKnownNat</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681105899"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105899"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105898"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105898"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">]</span><span>     </span><span class="hs-comment">-- clas = KnownNat</span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105897"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621681105897"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Integer
</span><a href="GHC.Core.Type.html#isNumLitTy"><span class="hs-identifier hs-var">isNumLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105898"><span class="hs-identifier hs-var">ty</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; EvExpr -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#makeLitDict"><span class="hs-identifier hs-var">makeLitDict</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105899"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105898"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; EvExpr
</span><a href="GHC.Core.Make.html#mkNaturalExpr"><span class="hs-identifier hs-var">mkNaturalExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621681105897"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-359"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchKnownNat"><span class="hs-identifier hs-var">matchKnownNat</span></a></span><span> </span><span id="local-6989586621681105894"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105894"><span class="hs-identifier hs-var">df</span></a></span></span><span> </span><span id="local-6989586621681105893"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105893"><span class="hs-identifier hs-var">sc</span></a></span></span><span> </span><span id="local-6989586621681105892"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105892"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105891"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105891"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var">matchInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105894"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105893"><span class="hs-identifier hs-var">sc</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105892"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105891"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-360"></span><span> </span><span class="hs-comment">-- See Note [Fabricating Evidence for Literals in Backpack] for why</span><span>
</span><span id="line-361"></span><span> </span><span class="hs-comment">-- this lookup into the instance environment is required.</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchKnownSymbol"><span class="hs-identifier hs-type">matchKnownSymbol</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-364"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>      </span><span class="hs-comment">-- True &lt;=&gt; caller is the short-cut solver</span><span>
</span><span id="line-365"></span><span>                              </span><span class="hs-comment">-- See Note [Shortcut solving: overlap]</span><span>
</span><span id="line-366"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-367"></span><span id="matchKnownSymbol"><span class="annot"><span class="annottext">matchKnownSymbol :: DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchKnownSymbol"><span class="hs-identifier hs-var hs-var">matchKnownSymbol</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681105890"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105890"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105889"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105889"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- clas = KnownSymbol</span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105888"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681105888"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe FastString
</span><a href="GHC.Core.Type.html#isStrLitTy"><span class="hs-identifier hs-var">isStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105889"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-369"></span><span>        </span><span id="local-6989586621681105886"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105886"><span class="hs-identifier hs-var">et</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; IOEnv (Env TcGblEnv TcLclEnv) EvExpr
forall (m :: * -&gt; *). MonadThings m =&gt; FastString -&gt; m EvExpr
</span><a href="GHC.Core.Make.html#mkStringExprFS"><span class="hs-identifier hs-var">mkStringExprFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681105888"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-370"></span><span>        </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; EvExpr -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#makeLitDict"><span class="hs-identifier hs-var">makeLitDict</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105890"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105889"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105886"><span class="hs-identifier hs-var">et</span></a></span><span>
</span><span id="line-371"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchKnownSymbol"><span class="hs-identifier hs-var">matchKnownSymbol</span></a></span><span> </span><span id="local-6989586621681105885"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105885"><span class="hs-identifier hs-var">df</span></a></span></span><span> </span><span id="local-6989586621681105884"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105884"><span class="hs-identifier hs-var">sc</span></a></span></span><span> </span><span id="local-6989586621681105883"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105883"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105882"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105882"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var">matchInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105885"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105884"><span class="hs-identifier hs-var">sc</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105883"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105882"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-372"></span><span> </span><span class="hs-comment">-- See Note [Fabricating Evidence for Literals in Backpack] for why</span><span>
</span><span id="line-373"></span><span> </span><span class="hs-comment">-- this lookup into the instance environment is required.</span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#makeLitDict"><span class="hs-identifier hs-type">makeLitDict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-type">EvExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-376"></span><span class="hs-comment">-- makeLitDict adds a coercion that will convert the literal into a dictionary</span><span>
</span><span id="line-377"></span><span class="hs-comment">-- of the appropriate type.  See Note [KnownNat &amp; KnownSymbol and EvLit]</span><span>
</span><span id="line-378"></span><span class="hs-comment">-- in GHC.Tc.Types.Evidence.  The coercion happens in 2 steps:</span><span>
</span><span id="line-379"></span><span class="hs-comment">--</span><span>
</span><span id="line-380"></span><span class="hs-comment">--     Integer -&gt; SNat n     -- representation of literal to singleton</span><span>
</span><span id="line-381"></span><span class="hs-comment">--     SNat n  -&gt; KnownNat n -- singleton to dictionary</span><span>
</span><span id="line-382"></span><span class="hs-comment">--</span><span>
</span><span id="line-383"></span><span class="hs-comment">--     The process is mirrored for Symbols:</span><span>
</span><span id="line-384"></span><span class="hs-comment">--     String    -&gt; SSymbol n</span><span>
</span><span id="line-385"></span><span class="hs-comment">--     SSymbol n -&gt; KnownSymbol n</span><span>
</span><span id="line-386"></span><span id="makeLitDict"><span class="annot"><span class="annottext">makeLitDict :: Class -&gt; Type -&gt; EvExpr -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#makeLitDict"><span class="hs-identifier hs-var hs-var">makeLitDict</span></a></span></span><span> </span><span id="local-6989586621681105881"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105881"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105880"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105880"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681105879"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105879"><span class="hs-identifier hs-var">et</span></a></span></span><span>
</span><span id="line-387"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105878"><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105878"><span class="hs-identifier hs-var">co_dict</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Maybe (Type, TcCoercion)
</span><a href="GHC.Tc.Instance.Family.html#tcInstNewTyCon_maybe"><span class="hs-identifier hs-var">tcInstNewTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105881"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105880"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-388"></span><span>          </span><span class="hs-comment">-- co_dict :: KnownNat n ~ SNat n</span><span>
</span><span id="line-389"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span> </span><span id="local-6989586621681105877"><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105877"><span class="hs-identifier hs-var">meth</span></a></span></span><span> </span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [DFunId]
</span><a href="GHC.Core.Class.html#classMethods"><span class="hs-identifier hs-var">classMethods</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105881"><span class="hs-identifier hs-var">clas</span></a></span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105875"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105875"><span class="hs-identifier hs-var">tcRep</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyCon
</span><a href="GHC.Core.Type.html#tyConAppTyCon_maybe"><span class="hs-identifier hs-var">tyConAppTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; Type
</span><a href="GHC.Core.Predicate.html#classMethodTy"><span class="hs-identifier hs-var">classMethodTy</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105877"><span class="hs-identifier hs-var">meth</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span>                    </span><span class="hs-comment">-- If the method type is forall n. KnownNat n =&gt; SNat n</span><span>
</span><span id="line-392"></span><span>                    </span><span class="hs-comment">-- then tcRep is SNat</span><span>
</span><span id="line-393"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105872"><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105872"><span class="hs-identifier hs-var">co_rep</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Maybe (Type, TcCoercion)
</span><a href="GHC.Tc.Instance.Family.html#tcInstNewTyCon_maybe"><span class="hs-identifier hs-var">tcInstNewTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105875"><span class="hs-identifier hs-var">tcRep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105880"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-394"></span><span>          </span><span class="hs-comment">-- SNat n ~ Integer</span><span>
</span><span id="line-395"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105871"><span class="annot"><span class="annottext">ev_tm :: EvTerm
</span><a href="#local-6989586621681105871"><span class="hs-identifier hs-var hs-var">ev_tm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvExpr -&gt; TcCoercion -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#mkEvCast"><span class="hs-identifier hs-var">mkEvCast</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105879"><span class="hs-identifier hs-var">et</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercion -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcCoercion -&gt; TcCoercion -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcTransCo"><span class="hs-identifier hs-var">mkTcTransCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105878"><span class="hs-identifier hs-var">co_dict</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105872"><span class="hs-identifier hs-var">co_rep</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ClsInstResult -&gt; TcM ClsInstResult)
-&gt; ClsInstResult -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-397"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">[EvExpr]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">EvTerm
</span><a href="#local-6989586621681105871"><span class="hs-identifier hs-var">ev_tm</span></a></span><span>
</span><span id="line-398"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-401"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM ClsInstResult
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;makeLitDict&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcM ClsInstResult) -&gt; SDoc -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-402"></span><span>      </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Unexpected evidence for&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; Name
</span><a href="GHC.Core.Class.html#className"><span class="hs-identifier hs-var hs-var">className</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105881"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-403"></span><span>      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(DFunId -&gt; SDoc) -&gt; [DFunId] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; SDoc) -&gt; (DFunId -&gt; Type) -&gt; DFunId -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; [DFunId]
</span><a href="GHC.Core.Class.html#classMethods"><span class="hs-identifier hs-var">classMethods</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105881"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-404"></span><span>
</span><span id="line-405"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
                   Class lookup for Typeable
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="hs-comment">-- | Assumes that we've checked that this is the 'Typeable' class,</span><span>
</span><span id="line-412"></span><span class="hs-comment">-- and it was applied to the correct argument.</span><span>
</span><span id="line-413"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchTypeable"><span class="hs-identifier hs-type">matchTypeable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-414"></span><span id="matchTypeable"><span class="annot"><span class="annottext">matchTypeable :: Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchTypeable"><span class="hs-identifier hs-var hs-var">matchTypeable</span></a></span></span><span> </span><span id="local-6989586621681105865"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105865"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105864"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105864"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105863"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- clas = Typeable</span><span>
</span><span id="line-415"></span><span>  </span><span class="hs-comment">-- For the first two cases, See Note [No Typeable for polytypes or qualified types]</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy"><span class="hs-identifier hs-var">isForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105864"><span class="hs-identifier hs-var">k</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span>   </span><span class="hs-comment">-- Polytype</span><span>
</span><span id="line-417"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe (Type, Type) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span>   </span><span class="hs-comment">-- Qualified type</span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span>  </span><span class="hs-comment">-- Now cases that do work</span><span>
</span><span id="line-420"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105864"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#typeNatKind"><span class="hs-identifier hs-var">typeNatKind</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyLit"><span class="hs-identifier hs-var">doTyLit</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#knownNatClassName"><span class="hs-identifier hs-var">knownNatClassName</span></a></span><span>         </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-421"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105864"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#typeSymbolKind"><span class="hs-identifier hs-var">typeSymbolKind</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyLit"><span class="hs-identifier hs-var">doTyLit</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#knownSymbolClassName"><span class="hs-identifier hs-var">knownSymbolClassName</span></a></span><span>      </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-422"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#tcIsConstraintKind"><span class="hs-identifier hs-var">tcIsConstraintKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; TyCon -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyConApp"><span class="hs-identifier hs-var">doTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105865"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#constraintKindTyCon"><span class="hs-identifier hs-var">constraintKindTyCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-423"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105852"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105852"><span class="hs-identifier hs-var">mult</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105851"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105851"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105850"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105850"><span class="hs-identifier hs-var">ret</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type, Type)
</span><a href="GHC.Core.Type.html#splitFunTy_maybe"><span class="hs-identifier hs-var">splitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; Type -&gt; Type -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doFunTy"><span class="hs-identifier hs-var">doFunTy</span></a></span><span>    </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105865"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105852"><span class="hs-identifier hs-var">mult</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105851"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105850"><span class="hs-identifier hs-var">ret</span></a></span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105847"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105847"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105846"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105846"><span class="hs-identifier hs-var">ks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-comment">-- See Note [Typeable (T a b c)]</span><span>
</span><span id="line-425"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#onlyNamedBndrsApplied"><span class="hs-identifier hs-var">onlyNamedBndrsApplied</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105847"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105846"><span class="hs-identifier hs-var">ks</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; TyCon -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyConApp"><span class="hs-identifier hs-var">doTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105865"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105847"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105846"><span class="hs-identifier hs-var">ks</span></a></span><span>
</span><span id="line-426"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105843"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105843"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105842"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105842"><span class="hs-identifier hs-var">kt</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#splitAppTy_maybe"><span class="hs-identifier hs-var">splitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; Type -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyApp"><span class="hs-identifier hs-var">doTyApp</span></a></span><span>    </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105865"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105863"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105843"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105842"><span class="hs-identifier hs-var">kt</span></a></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchTypeable"><span class="hs-identifier hs-var">matchTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span class="hs-comment">-- | Representation for a type @ty@ of the form @arg -&gt; ret@.</span><span>
</span><span id="line-431"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#doFunTy"><span class="hs-identifier hs-type">doFunTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-432"></span><span id="doFunTy"><span class="annot"><span class="annottext">doFunTy :: Class -&gt; Type -&gt; Type -&gt; Type -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doFunTy"><span class="hs-identifier hs-var hs-var">doFunTy</span></a></span></span><span> </span><span id="local-6989586621681105838"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105838"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105837"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105837"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681105836"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105836"><span class="hs-identifier hs-var">mult</span></a></span></span><span> </span><span id="local-6989586621681105835"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105835"><span class="hs-identifier hs-var">arg_ty</span></a></span></span><span> </span><span id="local-6989586621681105834"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105834"><span class="hs-identifier hs-var">ret_ty</span></a></span></span><span>
</span><span id="line-433"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ClsInstResult -&gt; TcM ClsInstResult)
-&gt; ClsInstResult -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105833"><span class="hs-identifier hs-var">preds</span></a></span><span>
</span><span id="line-434"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105832"><span class="hs-identifier hs-var">mk_ev</span></a></span><span>
</span><span id="line-435"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-436"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-437"></span><span>    </span><span id="local-6989586621681105833"><span class="annot"><span class="annottext">preds :: [Type]
</span><a href="#local-6989586621681105833"><span class="hs-identifier hs-var hs-var">preds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; [Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Instance.Class.html#mk_typeable_pred"><span class="hs-identifier hs-var">mk_typeable_pred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105838"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105836"><span class="hs-identifier hs-var">mult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105835"><span class="hs-identifier hs-var">arg_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105834"><span class="hs-identifier hs-var">ret_ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-438"></span><span>    </span><span id="local-6989586621681105832"><span class="annot"><span class="annottext">mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105832"><span class="hs-identifier hs-var hs-var">mk_ev</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105830"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105830"><span class="hs-identifier hs-var">mult_ev</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105829"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105829"><span class="hs-identifier hs-var">arg_ev</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105828"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105828"><span class="hs-identifier hs-var">ret_ev</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; EvTypeable -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evTypeable"><span class="hs-identifier hs-var">evTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105837"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">(EvTypeable -&gt; EvTerm) -&gt; EvTypeable -&gt; EvTerm
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-439"></span><span>                        </span><span class="annot"><span class="annottext">EvTerm -&gt; EvTerm -&gt; EvTerm -&gt; EvTypeable
</span><a href="GHC.Tc.Types.Evidence.html#EvTypeableTrFun"><span class="hs-identifier hs-var">EvTypeableTrFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105830"><span class="hs-identifier hs-var">mult_ev</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105829"><span class="hs-identifier hs-var">arg_ev</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105828"><span class="hs-identifier hs-var">ret_ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span>    </span><span class="annot"><a href="#local-6989586621681105832"><span class="hs-identifier hs-var">mk_ev</span></a></span><span> </span><span class="annot"><span class="annottext">[EvExpr]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; EvTerm
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Tc.Solver.Interact.doFunTy&quot;</span></span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-comment">-- | Representation for type constructor applied to some kinds.</span><span>
</span><span id="line-444"></span><span class="hs-comment">-- 'onlyNamedBndrsApplied' has ensured that this application results in a type</span><span>
</span><span id="line-445"></span><span class="hs-comment">-- of monomorphic kind (e.g. all kind variables have been instantiated).</span><span>
</span><span id="line-446"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#doTyConApp"><span class="hs-identifier hs-type">doTyConApp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-447"></span><span id="doTyConApp"><span class="annot"><span class="annottext">doTyConApp :: Class -&gt; Type -&gt; TyCon -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyConApp"><span class="hs-identifier hs-var hs-var">doTyConApp</span></a></span></span><span> </span><span id="local-6989586621681105822"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105822"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105821"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105821"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681105820"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105820"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681105819"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105819"><span class="hs-identifier hs-var">kind_args</span></a></span></span><span>
</span><span id="line-448"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier hs-var">tyConIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105820"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-449"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ClsInstResult -&gt; TcM ClsInstResult)
-&gt; ClsInstResult -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; [Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Instance.Class.html#mk_typeable_pred"><span class="hs-identifier hs-var">mk_typeable_pred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105822"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105819"><span class="hs-identifier hs-var">kind_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105817"><span class="hs-identifier hs-var">mk_ev</span></a></span><span>
</span><span id="line-451"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-452"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-453"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span>
</span><span id="line-454"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-455"></span><span>    </span><span id="local-6989586621681105817"><span class="annot"><span class="annottext">mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105817"><span class="hs-identifier hs-var hs-var">mk_ev</span></a></span></span><span> </span><span id="local-6989586621681105816"><span class="annot"><span class="annottext">[EvExpr]
</span><a href="#local-6989586621681105816"><span class="hs-identifier hs-var">kinds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; EvTypeable -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evTypeable"><span class="hs-identifier hs-var">evTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105821"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">(EvTypeable -&gt; EvTerm) -&gt; EvTypeable -&gt; EvTerm
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [EvTerm] -&gt; EvTypeable
</span><a href="GHC.Tc.Types.Evidence.html#EvTypeableTyCon"><span class="hs-identifier hs-var">EvTypeableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105820"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(EvExpr -&gt; EvTerm) -&gt; [EvExpr] -&gt; [EvTerm]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">[EvExpr]
</span><a href="#local-6989586621681105816"><span class="hs-identifier hs-var">kinds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span class="hs-comment">-- | Representation for TyCon applications of a concrete kind. We just use the</span><span>
</span><span id="line-458"></span><span class="hs-comment">-- kind itself, but first we must make sure that we've instantiated all kind-</span><span>
</span><span id="line-459"></span><span class="hs-comment">-- polymorphism, but no more.</span><span>
</span><span id="line-460"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#onlyNamedBndrsApplied"><span class="hs-identifier hs-type">onlyNamedBndrsApplied</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KindOrType"><span class="hs-identifier hs-type">KindOrType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-461"></span><span id="onlyNamedBndrsApplied"><span class="annot"><span class="annottext">onlyNamedBndrsApplied :: TyCon -&gt; [Type] -&gt; Bool
</span><a href="GHC.Tc.Instance.Class.html#onlyNamedBndrsApplied"><span class="hs-identifier hs-var hs-var">onlyNamedBndrsApplied</span></a></span></span><span> </span><span id="local-6989586621681105813"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105813"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681105812"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105812"><span class="hs-identifier hs-var">ks</span></a></span></span><span>
</span><span id="line-462"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyConBinder -&gt; Bool) -&gt; [TyConBinder] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">TyConBinder -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNamedTyConBinder"><span class="hs-identifier hs-var">isNamedTyConBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681105809"><span class="hs-identifier hs-var">used_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-463"></span><span>   </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TyConBinder -&gt; Bool) -&gt; [TyConBinder] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">TyConBinder -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNamedTyConBinder"><span class="hs-identifier hs-var">isNamedTyConBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681105807"><span class="hs-identifier hs-var">leftover_bndrs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-464"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-465"></span><span>   </span><span id="local-6989586621681105806"><span class="annot"><span class="annottext">bndrs :: [TyConBinder]
</span><a href="#local-6989586621681105806"><span class="hs-identifier hs-var hs-var">bndrs</span></a></span></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyConBinder]
</span><a href="GHC.Core.TyCon.html#tyConBinders"><span class="hs-identifier hs-var hs-var">tyConBinders</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105813"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-466"></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621681105809"><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681105809"><span class="hs-identifier hs-var">used_bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105807"><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681105807"><span class="hs-identifier hs-var">leftover_bndrs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [TyConBinder] -&gt; ([TyConBinder], [TyConBinder])
forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105812"><span class="hs-identifier hs-var">ks</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621681105806"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#doTyApp"><span class="hs-identifier hs-type">doTyApp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KindOrType"><span class="hs-identifier hs-type">KindOrType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-469"></span><span class="hs-comment">-- Representation for an application of a type to a type-or-kind.</span><span>
</span><span id="line-470"></span><span class="hs-comment">--  This may happen when the type expression starts with a type variable.</span><span>
</span><span id="line-471"></span><span class="hs-comment">--  Example (ignoring kind parameter):</span><span>
</span><span id="line-472"></span><span class="hs-comment">--    Typeable (f Int Char)                      --&gt;</span><span>
</span><span id="line-473"></span><span class="hs-comment">--    (Typeable (f Int), Typeable Char)          --&gt;</span><span>
</span><span id="line-474"></span><span class="hs-comment">--    (Typeable f, Typeable Int, Typeable Char)  --&gt; (after some simp. steps)</span><span>
</span><span id="line-475"></span><span class="hs-comment">--    Typeable f</span><span>
</span><span id="line-476"></span><span id="doTyApp"><span class="annot"><span class="annottext">doTyApp :: Class -&gt; Type -&gt; Type -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyApp"><span class="hs-identifier hs-var hs-var">doTyApp</span></a></span></span><span> </span><span id="local-6989586621681105804"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105804"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105803"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105803"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681105802"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105802"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681105801"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105801"><span class="hs-identifier hs-var">tk</span></a></span></span><span>
</span><span id="line-477"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy"><span class="hs-identifier hs-var">isForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105802"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-478"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#NoInstance"><span class="hs-identifier hs-var">NoInstance</span></a></span><span> </span><span class="hs-comment">-- We can't solve until we know the ctr.</span><span>
</span><span id="line-479"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-480"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ClsInstResult -&gt; TcM ClsInstResult)
-&gt; ClsInstResult -&gt; TcM ClsInstResult
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; [Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Instance.Class.html#mk_typeable_pred"><span class="hs-identifier hs-var">mk_typeable_pred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105804"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105802"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105801"><span class="hs-identifier hs-var">tk</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-481"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105799"><span class="hs-identifier hs-var">mk_ev</span></a></span><span>
</span><span id="line-482"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-483"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-484"></span><span>    </span><span id="local-6989586621681105799"><span class="annot"><span class="annottext">mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105799"><span class="hs-identifier hs-var hs-var">mk_ev</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105798"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105798"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105797"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105797"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; EvTypeable -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evTypeable"><span class="hs-identifier hs-var">evTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105803"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">(EvTypeable -&gt; EvTerm) -&gt; EvTypeable -&gt; EvTerm
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">EvTerm -&gt; EvTerm -&gt; EvTypeable
</span><a href="GHC.Tc.Types.Evidence.html#EvTypeableTyApp"><span class="hs-identifier hs-var">EvTypeableTyApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105798"><span class="hs-identifier hs-var">t1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105797"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-485"></span><span>    </span><span class="annot"><a href="#local-6989586621681105799"><span class="hs-identifier hs-var">mk_ev</span></a></span><span> </span><span class="annot"><span class="annottext">[EvExpr]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; EvTerm
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;doTyApp&quot;</span></span><span>
</span><span id="line-486"></span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span class="hs-comment">-- Emit a `Typeable` constraint for the given type.</span><span>
</span><span id="line-489"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#mk_typeable_pred"><span class="hs-identifier hs-type">mk_typeable_pred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-490"></span><span id="mk_typeable_pred"><span class="annot"><span class="annottext">mk_typeable_pred :: Class -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Instance.Class.html#mk_typeable_pred"><span class="hs-identifier hs-var hs-var">mk_typeable_pred</span></a></span></span><span> </span><span id="local-6989586621681105794"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105794"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105793"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105793"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105794"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105793"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105793"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span>  </span><span class="hs-comment">-- Typeable is implied by KnownNat/KnownSymbol. In the case of a type literal</span><span>
</span><span id="line-493"></span><span>  </span><span class="hs-comment">-- we generate a sub-goal for the appropriate class.</span><span>
</span><span id="line-494"></span><span>  </span><span class="hs-comment">-- See Note [Typeable for Nat and Symbol]</span><span>
</span><span id="line-495"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#doTyLit"><span class="hs-identifier hs-type">doTyLit</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-496"></span><span id="doTyLit"><span class="annot"><span class="annottext">doTyLit :: Name -&gt; Type -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#doTyLit"><span class="hs-identifier hs-var hs-var">doTyLit</span></a></span></span><span> </span><span id="local-6989586621681105792"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105792"><span class="hs-identifier hs-var">kc</span></a></span></span><span> </span><span id="local-6989586621681105791"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105791"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681105790"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105790"><span class="hs-identifier hs-var">kc_clas</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Class
</span><a href="GHC.Tc.Utils.Env.html#tcLookupClass"><span class="hs-identifier hs-var">tcLookupClass</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681105792"><span class="hs-identifier hs-var">kc</span></a></span><span>
</span><span id="line-497"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105788"><span class="annot"><span class="annottext">kc_pred :: Type
</span><a href="#local-6989586621681105788"><span class="hs-identifier hs-var hs-var">kc_pred</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105790"><span class="hs-identifier hs-var">kc_clas</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105791"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-498"></span><span>                        </span><span id="local-6989586621681105787"><span class="annot"><span class="annottext">mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105787"><span class="hs-identifier hs-var hs-var">mk_ev</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681105786"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105786"><span class="hs-identifier hs-var">ev</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; EvTypeable -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evTypeable"><span class="hs-identifier hs-var">evTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105791"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">(EvTypeable -&gt; EvTerm) -&gt; EvTypeable -&gt; EvTerm
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">EvTerm -&gt; EvTypeable
</span><a href="GHC.Tc.Types.Evidence.html#EvTypeableTyLit"><span class="hs-identifier hs-var">EvTypeableTyLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105786"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>                        </span><span class="annot"><a href="#local-6989586621681105787"><span class="hs-identifier hs-var">mk_ev</span></a></span><span> </span><span class="annot"><span class="annottext">[EvExpr]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; EvTerm
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;doTyLit&quot;</span></span><span>
</span><span id="line-500"></span><span>                  </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105788"><span class="hs-identifier hs-var">kc_pred</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-501"></span><span>                                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105787"><span class="hs-identifier hs-var">mk_ev</span></a></span><span>
</span><span id="line-502"></span><span>                                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="hs-comment">{- Note [Typeable (T a b c)]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For type applications we always decompose using binary application,
via doTyApp, until we get to a *kind* instantiation.  Example
   Proxy :: forall k. k -&gt; *

To solve Typeable (Proxy (* -&gt; *) Maybe) we
  - First decompose with doTyApp,
    to get (Typeable (Proxy (* -&gt; *))) and Typeable Maybe
  - Then solve (Typeable (Proxy (* -&gt; *))) with doTyConApp

If we attempt to short-cut by solving it all at once, via
doTyConApp

(this note is sadly truncated FIXME)


Note [No Typeable for polytypes or qualified types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We do not support impredicative typeable, such as
   Typeable (forall a. a-&gt;a)
   Typeable (Eq a =&gt; a -&gt; a)
   Typeable (() =&gt; Int)
   Typeable (((),()) =&gt; Int)

See #9858.  For forall's the case is clear: we simply don't have
a TypeRep for them.  For qualified but not polymorphic types, like
(Eq a =&gt; a -&gt; a), things are murkier.  But:

 * We don't need a TypeRep for these things.  TypeReps are for
   monotypes only.

 * Perhaps we could treat `=&gt;` as another type constructor for `Typeable`
   purposes, and thus support things like `Eq Int =&gt; Int`, however,
   at the current state of affairs this would be an odd exception as
   no other class works with impredicative types.
   For now we leave it off, until we have a better story for impredicativity.


Note [Typeable for Nat and Symbol]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We have special Typeable instances for Nat and Symbol.  Roughly we
have this instance, implemented here by doTyLit:
      instance KnownNat n =&gt; Typeable (n :: Nat) where
         typeRep = typeNatTypeRep @n
where
   Data.Typeable.Internals.typeNatTypeRep :: KnownNat a =&gt; TypeRep a

Ultimately typeNatTypeRep uses 'natSing' from KnownNat to get a
runtime value 'n'; it turns it into a string with 'show' and uses
that to whiz up a TypeRep TyCon for 'n', with mkTypeLitTyCon.
See #10348.

Because of this rule it's inadvisable (see #15322) to have a constraint
    f :: (Typeable (n :: Nat)) =&gt; blah
in a function signature; it gives rise to overlap problems just as
if you'd written
    f :: Eq [a] =&gt; blah
-}</span><span>
</span><span id="line-563"></span><span>
</span><span id="line-564"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
                   Class lookup for lifted equality
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span class="hs-comment">-- See also Note [The equality types story] in GHC.Builtin.Types.Prim</span><span>
</span><span id="line-571"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchHeteroEquality"><span class="hs-identifier hs-type">matchHeteroEquality</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-572"></span><span class="hs-comment">-- Solves (t1 ~~ t2)</span><span>
</span><span id="line-573"></span><span id="matchHeteroEquality"><span class="annot"><span class="annottext">matchHeteroEquality :: [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHeteroEquality"><span class="hs-identifier hs-var hs-var">matchHeteroEquality</span></a></span></span><span> </span><span id="local-6989586621681105784"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105784"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-574"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#eqPrimTyCon"><span class="hs-identifier hs-var">eqPrimTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105784"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-575"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Type] -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evDataConApp"><span class="hs-identifier hs-var">evDataConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#heqDataCon"><span class="hs-identifier hs-var">heqDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105784"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-576"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchHomoEquality"><span class="hs-identifier hs-type">matchHomoEquality</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-579"></span><span class="hs-comment">-- Solves (t1 ~ t2)</span><span>
</span><span id="line-580"></span><span id="matchHomoEquality"><span class="annot"><span class="annottext">matchHomoEquality :: [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHomoEquality"><span class="hs-identifier hs-var hs-var">matchHomoEquality</span></a></span></span><span> </span><span id="local-6989586621681105780"><span class="annot"><span class="annottext">args :: [Type]
</span><a href="#local-6989586621681105780"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span id="local-6989586621681105779"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105779"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105778"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105778"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681105777"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105777"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">]</span><span>
</span><span id="line-581"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#eqPrimTyCon"><span class="hs-identifier hs-var">eqPrimTyCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105779"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105779"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105778"><span class="hs-identifier hs-var">t1</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105777"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-582"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Type] -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evDataConApp"><span class="hs-identifier hs-var">evDataConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#eqDataCon"><span class="hs-identifier hs-var">eqDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105780"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-583"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchHomoEquality"><span class="hs-identifier hs-var">matchHomoEquality</span></a></span><span> </span><span id="local-6989586621681105775"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105775"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM ClsInstResult
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchHomoEquality&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105775"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span class="hs-comment">-- See also Note [The equality types story] in GHC.Builtin.Types.Prim</span><span>
</span><span id="line-587"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchCoercible"><span class="hs-identifier hs-type">matchCoercible</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-588"></span><span id="matchCoercible"><span class="annot"><span class="annottext">matchCoercible :: [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchCoercible"><span class="hs-identifier hs-var hs-var">matchCoercible</span></a></span></span><span> </span><span id="local-6989586621681105774"><span class="annot"><span class="annottext">args :: [Type]
</span><a href="#local-6989586621681105774"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span id="local-6989586621681105773"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105773"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105772"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105772"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105771"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105771"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">]</span><span>
</span><span id="line-589"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#eqReprPrimTyCon"><span class="hs-identifier hs-var">eqReprPrimTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105770"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-590"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Type] -&gt; [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evDataConApp"><span class="hs-identifier hs-var">evDataConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#coercibleDataCon"><span class="hs-identifier hs-var">coercibleDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105774"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-591"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinEqInstance"><span class="hs-identifier hs-var">BuiltinEqInstance</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-593"></span><span>    </span><span id="local-6989586621681105770"><span class="annot"><span class="annottext">args' :: [Type]
</span><a href="#local-6989586621681105770"><span class="hs-identifier hs-var hs-var">args'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105773"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105773"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105772"><span class="hs-identifier hs-var">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105771"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-594"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchCoercible"><span class="hs-identifier hs-var">matchCoercible</span></a></span><span> </span><span id="local-6989586621681105768"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105768"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM ClsInstResult
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchLiftedCoercible&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105768"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span>
</span><span id="line-597"></span><span class="hs-comment">{- ********************************************************************
*                                                                     *
              Class lookup for overloaded record fields
*                                                                     *
***********************************************************************-}</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span class="hs-comment">{-
Note [HasField instances]
~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have

    data T y = MkT { foo :: [y] }

and `foo` is in scope.  Then GHC will automatically solve a constraint like

    HasField &quot;foo&quot; (T Int) b

by emitting a new wanted

    T alpha -&gt; [alpha] ~# T Int -&gt; b

and building a HasField dictionary out of the selector function `foo`,
appropriately cast.

The HasField class is defined (in GHC.Records) thus:

    class HasField (x :: k) r a | x r -&gt; a where
      getField :: r -&gt; a

Since this is a one-method class, it is represented as a newtype.
Hence we can solve `HasField &quot;foo&quot; (T Int) b` by taking an expression
of type `T Int -&gt; b` and casting it using the newtype coercion.
Note that

    foo :: forall y . T y -&gt; [y]

so the expression we construct is

    foo @alpha |&gt; co

where

    co :: (T alpha -&gt; [alpha]) ~# HasField &quot;foo&quot; (T Int) b

is built from

    co1 :: (T alpha -&gt; [alpha]) ~# (T Int -&gt; b)

which is the new wanted, and

    co2 :: (T Int -&gt; b) ~# HasField &quot;foo&quot; (T Int) b

which can be derived from the newtype coercion.

If `foo` is not in scope, or has a higher-rank or existentially
quantified type, then the constraint is not solved automatically, but
may be solved by a user-supplied HasField instance.  Similarly, if we
encounter a HasField constraint where the field is not a literal
string, or does not belong to the type, then we fall back on the
normal constraint solver behaviour.
-}</span><span>
</span><span id="line-658"></span><span>
</span><span id="line-659"></span><span class="hs-comment">-- See Note [HasField instances]</span><span>
</span><span id="line-660"></span><span class="annot"><a href="GHC.Tc.Instance.Class.html#matchHasField"><span class="hs-identifier hs-type">matchHasField</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Class.html#ClsInstResult"><span class="hs-identifier hs-type">ClsInstResult</span></a></span><span>
</span><span id="line-661"></span><span id="matchHasField"><span class="annot"><span class="annottext">matchHasField :: DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchHasField"><span class="hs-identifier hs-var hs-var">matchHasField</span></a></span></span><span> </span><span id="local-6989586621681105767"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105767"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681105766"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105766"><span class="hs-identifier hs-var">short_cut</span></a></span></span><span> </span><span id="local-6989586621681105765"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105765"><span class="hs-identifier hs-var">clas</span></a></span></span><span> </span><span id="local-6989586621681105764"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105764"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-662"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681105763"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681105763"><span class="hs-identifier hs-var">fam_inst_envs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM FamInstEnvs
</span><a href="GHC.Tc.Instance.Family.html#tcGetFamInstEnvs"><span class="hs-identifier hs-var">tcGetFamInstEnvs</span></a></span><span>
</span><span id="line-663"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681105762"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681105762"><span class="hs-identifier hs-var">rdr_env</span></a></span></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn GlobalRdrEnv
</span><a href="GHC.Tc.Utils.Monad.html#getGlobalRdrEnv"><span class="hs-identifier hs-var">getGlobalRdrEnv</span></a></span><span>
</span><span id="line-664"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105764"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-665"></span><span>           </span><span class="hs-comment">-- We are matching HasField {k} x r a...</span><span>
</span><span id="line-666"></span><span>           </span><span class="hs-special">[</span><span id="local-6989586621681105760"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105760"><span class="hs-identifier hs-var">_k_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105759"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105759"><span class="hs-identifier hs-var">x_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105758"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105758"><span class="hs-identifier hs-var">r_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105757"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105757"><span class="hs-identifier hs-var">a_ty</span></a></span></span><span class="hs-special">]</span><span>
</span><span id="line-667"></span><span>               </span><span class="hs-comment">-- x should be a literal string</span><span>
</span><span id="line-668"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105756"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681105756"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe FastString
</span><a href="GHC.Core.Type.html#isStrLitTy"><span class="hs-identifier hs-var">isStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105759"><span class="hs-identifier hs-var">x_ty</span></a></span><span>
</span><span id="line-669"></span><span>               </span><span class="hs-comment">-- r should be an applied type constructor</span><span>
</span><span id="line-670"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105755"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105755"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105754"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105754"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105758"><span class="hs-identifier hs-var">r_ty</span></a></span><span>
</span><span id="line-671"></span><span>               </span><span class="hs-comment">-- use representation tycon (if data family); it has the fields</span><span>
</span><span id="line-672"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105752"><span class="annot"><span class="annottext">r_tc :: TyCon
</span><a href="#local-6989586621681105752"><span class="hs-identifier hs-var hs-var">r_tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon, [Type], TcCoercion) -&gt; TyCon
forall a b c. (a, b, c) -&gt; a
</span><a href="GHC.Utils.Misc.html#fstOf3"><span class="hs-identifier hs-var">fstOf3</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs -&gt; TyCon -&gt; [Type] -&gt; (TyCon, [Type], TcCoercion)
</span><a href="GHC.Tc.Instance.Family.html#tcLookupDataFamInst"><span class="hs-identifier hs-var">tcLookupDataFamInst</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681105763"><span class="hs-identifier hs-var">fam_inst_envs</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105755"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105754"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-673"></span><span>               </span><span class="hs-comment">-- x should be a field of r</span><span>
</span><span id="line-674"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105751"><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681105751"><span class="hs-identifier hs-var">fl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; TyCon -&gt; Maybe FieldLabel
</span><a href="GHC.Core.TyCon.html#lookupTyConFieldLabel"><span class="hs-identifier hs-var">lookupTyConFieldLabel</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681105756"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681105752"><span class="hs-identifier hs-var">r_tc</span></a></span><span>
</span><span id="line-675"></span><span>               </span><span class="hs-comment">-- the field selector should be in scope</span><span>
</span><span id="line-676"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681105749"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681105749"><span class="hs-identifier hs-var">gre</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; FieldLabel -&gt; Maybe GlobalRdrElt
</span><a href="GHC.Types.Name.Reader.html#lookupGRE_FieldLabel"><span class="hs-identifier hs-var">lookupGRE_FieldLabel</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681105762"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681105751"><span class="hs-identifier hs-var">fl</span></a></span><span>
</span><span id="line-677"></span><span>
</span><span id="line-678"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681105748"><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105748"><span class="hs-identifier hs-var">sel_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DFunId
</span><a href="GHC.Tc.Utils.Env.html#tcLookupId"><span class="hs-identifier hs-var">tcLookupId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FieldLabel -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681105751"><span class="hs-identifier hs-var">fl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-679"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105745"><span class="annot"><span class="annottext">[(Name, DFunId)]
</span><a href="#local-6989586621681105745"><span class="hs-identifier hs-var">tv_prs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105744"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105744"><span class="hs-identifier hs-var">preds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105743"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105743"><span class="hs-identifier hs-var">sel_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([DFunId] -&gt; TcM (TCvSubst, [DFunId]))
-&gt; DFunId -&gt; TcM ([(Name, DFunId)], [Type], Type)
</span><a href="GHC.Tc.Utils.Instantiate.html#tcInstType"><span class="hs-identifier hs-var">tcInstType</span></a></span><span> </span><span class="annot"><span class="annottext">[DFunId] -&gt; TcM (TCvSubst, [DFunId])
</span><a href="GHC.Tc.Utils.TcMType.html#newMetaTyVars"><span class="hs-identifier hs-var">newMetaTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105748"><span class="hs-identifier hs-var">sel_id</span></a></span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span>                         </span><span class="hs-comment">-- The first new wanted constraint equates the actual</span><span>
</span><span id="line-682"></span><span>                         </span><span class="hs-comment">-- type of the selector with the type (r -&gt; a) within</span><span>
</span><span id="line-683"></span><span>                         </span><span class="hs-comment">-- the HasField x r a dictionary.  The preds will</span><span>
</span><span id="line-684"></span><span>                         </span><span class="hs-comment">-- typically be empty, but if the datatype has a</span><span>
</span><span id="line-685"></span><span>                         </span><span class="hs-comment">-- &quot;stupid theta&quot; then we have to include it here.</span><span>
</span><span id="line-686"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681105741"><span class="annot"><span class="annottext">theta :: [Type]
</span><a href="#local-6989586621681105741"><span class="hs-identifier hs-var hs-var">theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Type
</span><a href="GHC.Core.Coercion.html#mkPrimEqPred"><span class="hs-identifier hs-var">mkPrimEqPred</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105743"><span class="hs-identifier hs-var">sel_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkVisFunTyMany"><span class="hs-identifier hs-var">mkVisFunTyMany</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105758"><span class="hs-identifier hs-var">r_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105757"><span class="hs-identifier hs-var">a_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105744"><span class="hs-identifier hs-var">preds</span></a></span><span>
</span><span id="line-687"></span><span>
</span><span id="line-688"></span><span>                         </span><span class="hs-comment">-- Use the equality proof to cast the selector Id to</span><span>
</span><span id="line-689"></span><span>                         </span><span class="hs-comment">-- type (r -&gt; a), then use the newtype coercion to cast</span><span>
</span><span id="line-690"></span><span>                         </span><span class="hs-comment">-- it to a HasField dictionary.</span><span>
</span><span id="line-691"></span><span>                         </span><span id="local-6989586621681105738"><span class="annot"><span class="annottext">mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105738"><span class="hs-identifier hs-var hs-var">mk_ev</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681105737"><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105737"><span class="hs-identifier hs-var">ev1</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681105736"><span class="annot"><span class="annottext">[EvExpr]
</span><a href="#local-6989586621681105736"><span class="hs-identifier hs-var">evs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DFunId -&gt; [Type] -&gt; [EvExpr] -&gt; EvExpr
</span><a href="GHC.Tc.Types.Evidence.html#evSelector"><span class="hs-identifier hs-var">evSelector</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105748"><span class="hs-identifier hs-var">sel_id</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105734"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[EvExpr]
</span><a href="#local-6989586621681105736"><span class="hs-identifier hs-var">evs</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr -&gt; TcCoercion -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#evCast"><span class="hs-operator hs-var">`evCast`</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105732"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-692"></span><span>                           </span><span class="hs-keyword">where</span><span>
</span><span id="line-693"></span><span>                             </span><span id="local-6989586621681105732"><span class="annot"><span class="annottext">co :: TcCoercion
</span><a href="#local-6989586621681105732"><span class="hs-identifier hs-var hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcCoercion -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSubCo"><span class="hs-identifier hs-var">mkTcSubCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvTerm -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#evTermCoercion"><span class="hs-identifier hs-var">evTermCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">EvExpr
</span><a href="#local-6989586621681105737"><span class="hs-identifier hs-var">ev1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-694"></span><span>                                      </span><span class="annot"><span class="annottext">TcCoercion -&gt; TcCoercion -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcTransCo"><span class="hs-operator hs-var">`mkTcTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercion -&gt; TcCoercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105729"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-695"></span><span>                         </span><span class="annot"><a href="#local-6989586621681105738"><span class="hs-identifier hs-var">mk_ev</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; EvTerm
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;matchHasField.mk_ev&quot;</span></span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span>                         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681105729"><span class="annot"><span class="annottext">TcCoercion
</span><a href="#local-6989586621681105729"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Maybe (Type, TcCoercion)
</span><a href="GHC.Tc.Instance.Family.html#tcInstNewTyCon_maybe"><span class="hs-identifier hs-var">tcInstNewTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105765"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-698"></span><span>                                                              </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105764"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-699"></span><span>
</span><span id="line-700"></span><span>                         </span><span id="local-6989586621681105734"><span class="annot"><span class="annottext">tvs :: [Type]
</span><a href="#local-6989586621681105734"><span class="hs-identifier hs-var hs-var">tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[DFunId] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Name, DFunId) -&gt; DFunId) -&gt; [(Name, DFunId)] -&gt; [DFunId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, DFunId) -&gt; DFunId
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, DFunId)]
</span><a href="#local-6989586621681105745"><span class="hs-identifier hs-var">tv_prs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-701"></span><span>
</span><span id="line-702"></span><span>                     </span><span class="hs-comment">-- The selector must not be &quot;naughty&quot; (i.e. the field</span><span>
</span><span id="line-703"></span><span>                     </span><span class="hs-comment">-- cannot have an existentially quantified type), and</span><span>
</span><span id="line-704"></span><span>                     </span><span class="hs-comment">-- it must not be higher-rank.</span><span>
</span><span id="line-705"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DFunId -&gt; Bool
</span><a href="GHC.Types.Id.html#isNaughtyRecordSelector"><span class="hs-identifier hs-var">isNaughtyRecordSelector</span></a></span><span> </span><span class="annot"><span class="annottext">DFunId
</span><a href="#local-6989586621681105748"><span class="hs-identifier hs-var">sel_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isTauTy"><span class="hs-identifier hs-var">isTauTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681105743"><span class="hs-identifier hs-var">sel_ty</span></a></span><span>
</span><span id="line-706"></span><span>                     </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GlobalRdrElt -&gt; TcRn ()
</span><a href="GHC.Rename.Env.html#addUsedGRE"><span class="hs-identifier hs-var">addUsedGRE</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681105749"><span class="hs-identifier hs-var">gre</span></a></span><span>
</span><span id="line-707"></span><span>                             </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ClsInstResult -&gt; TcM ClsInstResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">OneInst :: [Type] -&gt; ([EvExpr] -&gt; EvTerm) -&gt; InstanceWhat -&gt; ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#OneInst"><span class="hs-identifier hs-type">OneInst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cir_new_theta :: [Type]
</span><a href="GHC.Tc.Instance.Class.html#cir_new_theta"><span class="hs-identifier hs-var">cir_new_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105741"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-708"></span><span>                                              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_mk_ev :: [EvExpr] -&gt; EvTerm
</span><a href="GHC.Tc.Instance.Class.html#cir_mk_ev"><span class="hs-identifier hs-var">cir_mk_ev</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvExpr] -&gt; EvTerm
</span><a href="#local-6989586621681105738"><span class="hs-identifier hs-var">mk_ev</span></a></span><span>
</span><span id="line-709"></span><span>                                              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cir_what :: InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#cir_what"><span class="hs-identifier hs-var">cir_what</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstanceWhat
</span><a href="GHC.Tc.Instance.Class.html#BuiltinInstance"><span class="hs-identifier hs-var">BuiltinInstance</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-710"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var">matchInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105767"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105766"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105765"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105764"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span>           </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool -&gt; Class -&gt; [Type] -&gt; TcM ClsInstResult
</span><a href="GHC.Tc.Instance.Class.html#matchInstEnv"><span class="hs-identifier hs-var">matchInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681105767"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681105766"><span class="hs-identifier hs-var">short_cut</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681105765"><span class="hs-identifier hs-var">clas</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681105764"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-713"></span></pre></body></html>